Skip to content
This repository has been archived by the owner on Aug 17, 2020. It is now read-only.

Trace context support in propagation Inject/Extract #105

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

tonyredondo
Copy link
Contributor

@tonyredondo tonyredondo commented Jan 9, 2020

Trace context support in propagation Inject/Extract

  • Currently injects both ot- and traceparent headers for compatibility with OTel receptors.

  • Try to extract both ot- and traceparent headers

  • TraceID changed from UInt64 to UUID

Implementation based on: https://www.w3.org/TR/trace-context-1/

@tonyredondo tonyredondo self-assigned this Jan 9, 2020
@tonyredondo tonyredondo added WIP and removed WIP labels Jan 13, 2020
@fermayo
Copy link
Member

fermayo commented Jan 13, 2020

@tonyredondo is this ready to be reviewed?

@tonyredondo
Copy link
Contributor Author

No, this is on hold based in the conversation today of random in 64 bits

Comment on lines 66 to 68
for k, v := range sc.Baggage {
carrier.Set(prefixBaggage+k, v)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot locate the tracestate header for the baggage in OTel format.

return opentracing.ErrSpanContextCorrupted
}
traceParentArray := strings.Split(v, "-")
if len(traceParentArray) < 4 || traceParentArray[0] != "00" || len(traceParentArray[1]) != 32 || len(traceParentArray[2]) != 16 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(traceParentArray) < 4 || traceParentArray[0] != "00" || len(traceParentArray[1]) != 32 || len(traceParentArray[2]) != 16 {
if len(traceParentArray) != 4 || traceParentArray[0] != "00" || len(traceParentArray[1]) != 32 || len(traceParentArray[2]) != 16 {

return opentracing.ErrSpanContextCorrupted
}

traceID, err = uuid.Parse(traceParentArray[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Inject method, it is being removed the - characters, and here it is being parse without them. Canuuid.Parse function parse UUIDs without -?

err = carrier.ForeachKey(func(k, v string) error {
switch strings.ToLower(k) {
case fieldNameTraceID:
traceID, err = strconv.ParseUint(v, 16, 64)
traceID, err = uuid.Parse(v)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change implies all agents need to send UUID, isn't?

@@ -122,7 +175,9 @@ func (p *binaryPropagator) Inject(
}

state := wire.TracerState{}
Copy link
Contributor

@drodriguezhdez drodriguezhdez Mar 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curiosity, are we using the binary protocol? Is there any standard for that?

@tonyredondo tonyredondo force-pushed the trace-context branch 4 times, most recently from 8c172d4 to d624e51 Compare March 18, 2020 16:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants